import { Map } from "immutable";

import * as actionTypes from "./constants";

const defaultState = Map({
    rankingMenuList: [],
    rankingConten: {},
    musicUrl: [],
    musicDetails: [],
});

function reducer(state = defaultState, action) {
    switch (action.type) {
        case actionTypes.CHANGE_RANKING:
            return state.set("rankingMenuList", action.rankingMenuList);
        case actionTypes.CHANGE_CONTENT:
            return state.set("rankingConten", action.rankingConten);
        case actionTypes.CHANGE_MUSIC_DETAILS:
            return state.set("musicDetails", action.musicDetails);
        case actionTypes.CHANGE_MUSIC_URL:
            return state.set("musicUrl", action.musicUrl);
        default:
            return state;
    }
}

export default reducer;
